<template>
  <div class="console-layout">
    <div class="console-header">
      <h2>{{ title }}</h2>
    </div>
    <div class="console-content">
      <router-view />
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, computed } from 'vue'
import { useRoute } from 'vue-router'

export default defineComponent({
  name: 'ConsoleLayout',
  setup() {
    const route = useRoute()
    
    const title = computed(() => {
      const name = route.name as string
      if (name.includes('Dashboard')) return '控制台仪表盘'
      if (name.includes('BasicSettings')) return '基础设置'
      if (name.includes('UserManagement')) return '用户管理'
      if (name.includes('SystemLogs')) return '系统日志'
      return '控制台'
    })

    return {
      title
    }
  }
})
</script>

<style scoped>
.console-layout {
  padding: 20px;
}

.console-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e6e8ec;
}

.console-header h2 {
  color: #303133;
  font-weight: 500;
  margin: 0;
}

.console-content {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
</style>